<template>
  <div class="rivate-key-management-wrapper">
    <v-contentHead :head-title="$t('title.contractTitle')" :head-sub-title="$t('title.contractList')" @changGroup="changGroup" />

    <el-tabs v-model="activeName" class="search-part" @tab-click="handleClick">
      <el-tab-pane :label="$t('title.registered')" name="registered">
        <registered-contract v-if="activeName === &quot;registered&quot;" ref="registered" />
      </el-tab-pane>
      <el-tab-pane :label="$t('title.all')" name="total">
        <total-contract v-if="activeName === &quot;total&quot;" ref="total" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import registeredContract from './oldContract'
import totalContract from './totalContract'
import contentHead from '@/components/contentHead'
export default {
  name: 'ContractList',
  components: {
    registeredContract,
    totalContract,
    'v-contentHead': contentHead
  },
  data() {
    return {
      activeName: null

    }
  },
  created() {
    if (this.$route.query.tab === 'total') {
      this.activeName = 'total'
    } else {
      this.activeName = 'registered'
    }
  },
  methods: {
    handleClick() {
      //   if (this.activeName === 'total') {
      //         this.$refs.total.getList()
      //     } else {
      //         this.$refs.registered.getContracts()
      //     }
    },
    changGroup(data) {
      if (this.activeName === 'total') {
        this.$refs.total.getList()
      } else {
        this.$refs.registered.changGroup(data)
      }
    }
  }
}
</script>

<style>

</style>
